# Contributor: Leo <thinkabit.ukim@gmail.com>
# Maintainer:
pkgname=tl-expected
pkgver=1.0.0
pkgrel=3
pkgdesc="C++11/14/17 std::expected with functional-style extensions"
options="!check"
url="https://github.com/TartanLlama/expected"
arch="noarch"
license="CC0-1.0"
makedepends="cmake"
source="$pkgname-$pkgver.tar.gz::https://github.com/TartanLlama/expected/archive/v$pkgver.tar.gz"
builddir="$srcdir/expected-$pkgver"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=True \
		-DEXPECTED_ENABLE_TESTS=OFF \
		$CMAKE_CROSSOPTS .
	make -C build
}

package() {
	make -C build DESTDIR="$pkgdir" install

	mkdir -p "$pkgdir"/usr/lib
	mv "$pkgdir"/usr/share/cmake "$pkgdir"/usr/lib
}

sha512sums="747ea34b5540dfcf595896332851f10c52a823ab8ba3fc8152478b0a9e8ca01f0f26827348407249827f4106ff577bd6e697ea6f749c1f21bd1f0913a621075d  tl-expected-1.0.0.tar.gz"
